/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cmp.arena.controls;

import com.jme3.light.AmbientLight;
import com.jme3.light.PointLight;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.Spatial;
import com.jme3.scene.control.AbstractControl;
import com.jme3.scene.control.Control;

/**
 * Handles the Lighting of the playing field.
 * @author krummer
 */
public class LightingControl extends AbstractControl {
    
    /**
     * Add light to the map.
     * get light from scene in the future?
     * Add functions to manipulate the light while a game is running:
     * adjust color, intensity, ...
     * 
     * @param spatial player node.
     */
    @Override
    public void setSpatial(Spatial spatial){
        super.setSpatial(spatial);
        
        //TODO: add light information to mapNode. so we can mess with it.
        
        // We add light so we see the scene
        AmbientLight al = new AmbientLight();
        al.setColor(ColorRGBA.Yellow.mult(1.3f));
        spatial.addLight(al);

        PointLight pl = new PointLight();
        pl.setColor(ColorRGBA.White);
        pl.setPosition(new Vector3f(3.f,2.f,4.f));
        spatial.addLight(pl);
    }

    @Override
    protected void controlUpdate(float tpf) {
    }

    @Override
    protected void controlRender(RenderManager rm, ViewPort vp) {
    }

    public Control cloneForSpatial(Spatial spatial) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
}
